import { defineStore } from 'pinia'
import { ref } from 'vue'
import { homeGetCategoryList } from '@/api/home'

export const useCategoryStore = defineStore('category', () => {
  // 导航分类数据（为了让吸顶导航和导航只发一次数据请求把数据放在pinia统一管理）
  const categoryList = ref([]);
  const getCategoryList = async () => {
    const res = await homeGetCategoryList();
    categoryList.value = res.result;
  };

  return {
    categoryList,
    getCategoryList
  }
})
